/*
 * Copyright (c) 2005 Your Corporation. All Rights Reserved.
 */
package com.yesky.common.taglib;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.components.Component;
import org.apache.struts2.views.jsp.ComponentTagSupport;

import com.opensymphony.xwork2.util.ValueStack;

/**
 * User: Yangsy
 * Date: 2005-3-8
 * Time: 14:38:37
 * To change this template use File | Settings | File Templates.
 */
public class ListPageTag extends ComponentTagSupport {
    private String pageKey = "pageIndex";
    private String name = PaginatedList.COMMONLIST_TAG_KEY;
    private int pageNum = 5;
    private String style = "html";
    private String target = "_self";
    private HttpServletRequest request;

    public String getPageKey() {
        return pageKey;
    }

    public void setPageKey(String pageKey) {
        this.pageKey = pageKey;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public String getStyle() {
        return style;
    }

    public void setStyle(String style) {
        this.style = style;
    }

    public String getTarget() {
        return target;
    }

    public void setTarget(String target) {
        this.target = target;
    }

    public HttpServletRequest getRequest() {
        return request;
    }

    public void setRequest(HttpServletRequest request) {
        this.request = request;
    }


    public Component getBean(ValueStack valueStack, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
        ListPage listPage = new ListPage(valueStack);
        listPage.setRequest(httpServletRequest);
        listPage.setName(name);
        listPage.setPageKey(pageKey);
        listPage.setStyle(style);
        listPage.setTarget(target);
        listPage.setPageNum(pageNum);
        return listPage;
    }
}
